package admin;

import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import org.omg.CORBA.ORB;

import player.PlayerClient;
import player.playerService;
import player.playerServiceHelper;
import administrator.administratorService;
import administrator.administratorServiceHelper;
import common.CommonTools;

public class AdminClientTest {

	public static void main(String[] args) {
		
				String adminIPAddressEU = CommonTools.getproperty(
						"client.properties", "clientIPAddressEU");
				String adminIPAddressNA = CommonTools.getproperty(
						"client.properties", "clientIPAddressNA");
				String adminIPAddressAS = CommonTools.getproperty(
						"client.properties", "clientIPAddressAS");
				//-------------------------------------------------------------------------------
				ORB orbEU = ORB.init(args, null);
				ORB orbAS = ORB.init(args, null);
				ORB orbNA = ORB.init(args, null);
				
				String adminIOR_EU = CommonTools.getIOR("admin", "EU","client");
				String adminIOR_AS = CommonTools.getIOR("admin", "AS","client");
				String adminIOR_NA = CommonTools.getIOR("admin", "NA","client");
		
				org.omg.CORBA.Object administratorServiceEUObject = orbEU.string_to_object(adminIOR_EU);
				org.omg.CORBA.Object administratorServiceASObject = orbAS.string_to_object(adminIOR_AS);
				org.omg.CORBA.Object administratorServiceNAObject = orbNA.string_to_object(adminIOR_NA);
				
				administratorService administratorServiceEU = administratorServiceHelper.narrow(administratorServiceEUObject);
				administratorService administratorServiceAS = administratorServiceHelper.narrow(administratorServiceASObject);
				administratorService administratorServiceNA = administratorServiceHelper.narrow(administratorServiceNAObject);
				
			
			AdminClient adminClientEU = new AdminClient(administratorServiceEU);
			AdminClient adminClientNA = new AdminClient(administratorServiceNA);
			AdminClient adminClientAS = new AdminClient(administratorServiceAS);

			new Thread(new AdminPlayerStatusThread(adminClientEU, "Admin", "Admin", adminIPAddressEU)).start();
			/*new Thread(new AdminPlayerStatusThread(adminClientNA, "Admin", "Admin", adminIPAddressNA)).start();
			new Thread(new AdminPlayerStatusThread(adminClientAS, "Admin", "Admin", adminIPAddressAS)).start();
			
			new Thread(new AdminSuspendAccountThread(adminClientEU, "Admin", "Admin", adminIPAddressEU,"Clinton")).start();
			new Thread(new AdminSuspendAccountThread(adminClientNA, "Admin", "Admin", adminIPAddressNA,"Clinton")).start();
			new Thread(new AdminSuspendAccountThread(adminClientAS, "Admin", "Admin", adminIPAddressAS,"Clinton")).start();*/
			
			//new Thread(new AdminClientThread(adminClientEU, "Admin", "Admin1", adminIPAddressEU)).start();
			//new Thread(new AdminClientThread(adminClientNA, "Admin", "Admin1", adminIPAddressNA)).start();
			//new Thread(new AdminClientThread(adminClientAS, "Admin", "Admin1", adminIPAddressAS)).start();

		
	}

}
